package src.com.neusoft.nep.controller;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.SplitPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URL;

public class FirstWebViewController {
    @FXML
    private Button btn_publicSupervisor;
    @FXML
    private Button btn_gridInspector;
    @FXML
    private Button btn_adminUser;

    public void publicSupervisor() throws IOException {
        Stage stage = new Stage();
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../view/PublicSupervisorLoginView.fxml");
        fxmlLoader.setLocation(url);
        Parent root = null;
        try {
            root = fxmlLoader.load();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
        PublicSupervisorLoginViewController controller = fxmlLoader.getController();
        controller.setLoginViewStage(stage);

        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.showAndWait();
    }
    public void gridInspector() throws IOException {
        Stage stage = new Stage();
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../view/NepgLoginView.fxml");
        fxmlLoader.setLocation(url);
        Parent root = null;
        try {
            root = fxmlLoader.load();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
        NepgLoginViewController controller = fxmlLoader.getController();
        controller.setLoginViewStage(stage);

        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.showAndWait();

    }
    public void adminUser() throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../view/AdminUserLoginView.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_adminUser.getScene();
        Stage stage = (Stage) scene.getWindow();
        scene.setRoot(root);
        stage.setScene(scene);
        stage.show();
        stage.setResizable(false);
        stage.setMaximized(true);
    }
}
